#pragma once
#include "Windows.h"

using namespace System;
using namespace System::Threading;
using namespace System::Diagnostics;

#define WM_USER_STOP WM_USER+100
#define START 1
#define STOP 2
#define TARGET_MISSING 3

ref class CLimitor
{
public:
	CLimitor(void);
	void Start();
	void Stop();
	void SetTarget(int pid);
	void SetTimeGreen(int value);

private:
	Thread^ watchThread;
	Thread^ hackThread;
	Semaphore^ watchSemaphore;
	BOOL realTime;
	int timeGreen;
	int targetPid;
	bool watch;
	void Watch();
	void Hack();
	void WriteDebug(String^ message);
	BOOL EnableDebugPrivilege( HANDLE hToken, BOOL bEnable );
	int ListProcessThreads( DWORD dwOwnerPID, DWORD * dwThreadIdTable );
private:
	const static int MAX_THREADS=100;
	const static int MAX_LOOPS=100;
public: 
	HWND m_HWMD;
};
